package cn.chenwx.bbsforum.service;

import cn.chenwx.bbsforum.entity.User;
import cn.chenwx.bbsforum.utils.BlogJSONResult;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface UserService {

    List<User> findAllUser( int pageNum,int rows);

    User findUserById(int id);

    BlogJSONResult addUser(User user);

    int modifyUser(User user,int id);

    int deleteUser(int id);

    User findUserByName(String name);

    int getUserNum();

    BlogJSONResult updateUserStatus(int status, int id);

    BlogJSONResult updateUser(User user,int id);
    @Transactional
    void updateAvatarImgUrlById(String avatarImgUrl, int id);

    /**
     * 获得用户头像的地址
     * @return 头像的url
     */
    BlogJSONResult getHeadPortraitUrl(int userId);


    BlogJSONResult getUserPersonalInfoByUsername(String username);

    boolean usernameIsExist(String username);

    BlogJSONResult savePersonalDate(User user, String username);
}
